package com.jltx.xq.simplewatch.widget.LayoutManager;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.util.AttributeSet;

/**
 * @author jltxseo
 * @date 2017/09/26.
 * @description:  可禁止recyclerView滑动的LinearLayoutManager
 */

public class SwipeableLinearLayoutManager extends LinearLayoutManager{
    private boolean isCanScroll = true;

    public SwipeableLinearLayoutManager(Context context) {
        super(context);
    }

    public SwipeableLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
    }

    public SwipeableLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public boolean canScrollHorizontally() {
        return super.canScrollHorizontally() && isCanScroll;
    }

    @Override
    public boolean canScrollVertically() {
        return super.canScrollVertically() && isCanScroll;
    }

    public boolean isCanScroll() {
        return isCanScroll;
    }

    public void setCanScroll(boolean canScroll) {
        isCanScroll = canScroll;
    }
}
